<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <a href="#page1.html" id="page1">页面一</a>&nbsp;&nbsp;
    <a href="#page2.html" id="page2">页面二</a>
    <script>
      addEventListener(
        'popstate',
        function (e) {
          console.log(e.state)
        },
        false
      )
    </script>
  </body>
</html>
